Repository navigation
fix(harness): count tool call arguments once in context estimates - #4499
Merged
jujn merged 2 commits intoDec 3, 2026
Merged
Conversation
Contributor
Author
|
Windows CI hit a timeout in an existing test. Plz rerun the failed job. Thanks! |
Contributor
Author
|
Thanks, @xzxiaoshan, the ci looks good. |
Contributor
Author
|
Hi, @jujn could you ptal at this PR when you get a chance? |
jujn
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4495
Count tool-call arguments once in
ContextTokenEstimator.approximate()usingJsonUtils.resolveToolCallArgsJson(). This uses the same argument selection and sanitization as the formatter instead of adding both parsed input and raw content.Adds regression tests for duplicate streamed arguments, raw argument precedence, empty/invalid argument fallback, malformed argument sanitization, and retaining thinking content in the estimate.
Validation (Java 17):
mvn -B -T1C -pl agentscope-harness -am test spotless:checkpasses. Test summaries report 607 and 2,301 tests, with 37 skipped and no failures or errors.git diff --checkpasses.